#include "SpellEffect.h"

SpellEffect::SpellEffect()
{
    healing = 0;
}
SpellEffect::SpellEffect(float coeff, float stdMin, float stdMax, int numTicks)
{
    coefficient = coeff;
    stdHealthPercentMin = stdMin;
    stdHealthPercentMax = stdMax;
    stdHealthPercentAvg = (stdMin + stdMax)/2.0;
    standardHealth = 7085;
    standardHealthDamage = 1610;
    amountModifierPercent = 0;
    isWeaponDamage = false;
    healing = 0;
    ticks = numTicks;
}
SpellEffect::SpellEffect(float coeff, float stdMin, float stdMax)
{
    coefficient = coeff;
    stdHealthPercentMin = stdMin;
    stdHealthPercentMax = stdMax;
    stdHealthPercentAvg = (stdMin + stdMax)/2.0;
    standardHealth = 7085;
    standardHealthDamage = 1610;
    amountModifierPercent = 0;
    isWeaponDamage = false;
    healing = 0;
}

SpellEffect::SpellEffect(double coeff, double stdMin, double stdMax, double amountModPercent)
{
    coefficient = coeff;
    stdHealthPercentMin = stdMin;
    stdHealthPercentMax = stdMax;
    stdHealthPercentAvg = (stdMin + stdMax)/2.0;
    standardHealth = 7085;
    healing = 0;
    standardHealthDamage = 1610;
    amountModifierPercent = amountModPercent;
    isWeaponDamage = true;
}

SpellEffect::~SpellEffect()
{
}

/*void SpellEffect::setValues(double coeff, double stdMin, double stdMax, double amountModPercent)
{
    coefficient = coeff;
    stdHealthPercentMin = stdMin;
    stdHealthPercentMax = stdMax;
    stdHealthPercentAvg = (stdMin + stdMax)/2.0;
    standardHealth = 7085;
    standardHealthDamage = 1610;
    amountModifierPercent = amountModPercent;
    isWeaponDamage = true;
    ticks =1;
}*/

void SpellEffect::setValues(double coeff, double stdMin, double stdMax, int numTicks, double amountModPercent)
{
    coefficient = coeff;
    stdHealthPercentMin = stdMin;
    stdHealthPercentMax = stdMax;
    stdHealthPercentAvg = (stdMin + stdMax)/2.0;
    standardHealth = 7085;
    standardHealthDamage = 1610;
    amountModifierPercent = amountModPercent;
    isWeaponDamage = true;
    ticks = numTicks;
}

void SpellEffect::setValues(float coeff, float stdMin, float stdMax)
{
    coefficient = coeff;
    stdHealthPercentMin = stdMin;
    stdHealthPercentMax = stdMax;
    stdHealthPercentAvg = (stdMin + stdMax)/2.0;
    standardHealth = 7085;
    standardHealthDamage = 1610;
    isWeaponDamage = false;
    ticks = 1;
}

void SpellEffect::setValues(float coeff, float stdMin, float stdMax, int numTicks)
{
    coefficient = coeff;
    stdHealthPercentMin = stdMin;
    stdHealthPercentMax = stdMax;
    stdHealthPercentAvg = (stdMin + stdMax)/2.0;
    standardHealth = 7085;
    standardHealthDamage = 1610;
    isWeaponDamage = false;
    ticks = numTicks;
}

double SpellEffect::getDamage(double bonusDamage, double MH_max, double MH_min, double OH_max, double OH_min, bool isBasicAttack)
{

    double MH_avg = (MH_max + MH_min)/2;
    double OH_avg = (OH_max + OH_min)/2;
    if(isBasicAttack == true){
      damage = (MH_avg+OH_avg*0.3) + coefficient * bonusDamage;
    }else{
    if(isWeaponDamage == true){

    damage = ( amountModifierPercent+1)*(MH_avg+OH_avg*0.3)+ coefficient * bonusDamage + stdHealthPercentAvg * standardHealthDamage;
    }
    else{
        damage = coefficient * bonusDamage + stdHealthPercentAvg * standardHealthDamage;
    }
    }
    return damage;
}

float SpellEffect::getHealing(float bonusHealing)
{
    healing = (coefficient * bonusHealing + stdHealthPercentAvg * standardHealth) * ticks;
    return healing;
}
